package com.nut.course.enums;

import lombok.Getter;

import java.util.HashMap;
import java.util.Map;

@Getter
public enum CourseStatusEnum {

    DRAFT(0, "草稿"),
    CHECK_WAIT_1(11, "一级待审批"),
    CHECK_FAIL_1(12, "一级不通过"),
    CHECK_WAIT_2(21, "二级待审批"),
    CHECK_FAIL_2(22, "二级不通过"),
    WAIT_PUBLISH(30, "待发布");

    private Integer value;
    private String name;

    CourseStatusEnum(Integer value, String name) {
        this.value = value;
        this.name = name;
    }

    private static Map<Integer, CourseStatusEnum> map = new HashMap<>();

    static {
        for (CourseStatusEnum courseStatusEnum : CourseStatusEnum.values()) {
            map.put(courseStatusEnum.value, courseStatusEnum);
        }
    }

    public static CourseStatusEnum valueOf(int value) {
        return map.get(value);
    }
}
